package com.hongyun.sdk.common;

import java.util.HashMap;
import java.util.Map;

public enum OilDictionary {

    HY_OLI1(1, "0#柴油", "0#", "柴油"),
    HY_OLI2(2, "LNG", "LNG", "LNG"),
    HY_OLI3(3, "B5生物柴油", "B5", "生物柴油"),
    HY_OLI4(4, "-10#柴油", "-10#", "柴油"),
    HY_OLI5(5, "-35#柴油", "-35#", "柴油"),
    HY_OLI6(6, "-20#柴油", "-20#", "柴油");

    private final int code;
    private final String fuelName;
    private final String fuelNumber;
    private final String fuelDesc;

    OilDictionary(int code, String fuelName, String fuelNumber, String fuelDesc) {
        this.code = code;
        this.fuelName = fuelName;
        this.fuelNumber = fuelNumber;
        this.fuelDesc = fuelDesc;
    }


    public static Map<Integer, OilDictionary> toMap() {
        Map<Integer, OilDictionary> map = new HashMap<Integer, OilDictionary>();
        for (OilDictionary dictionary : OilDictionary.values()) {
            map.put(dictionary.getCode(), dictionary);
        }
        return map;
    }

    public static OilDictionary getOilDictionaryByCode(Integer code) {
        OilDictionary result = null;
        Map<Integer, OilDictionary> multiMap = OilDictionary.toMap();
        for (Map.Entry<Integer, OilDictionary> stringObjectEntry : multiMap.entrySet()) {
            if (stringObjectEntry.getKey().equals(code)) {
                result = stringObjectEntry.getValue();
            }
        }
        return result;
    }


    public int getCode() {
        return code;
    }

    public String getFuelName() {
        return fuelName;
    }

    public String getFuelNumber() {
        return fuelNumber;
    }

    public String getFuelDesc() {
        return fuelDesc;
    }

}
